package cn.net.yugu.doraemon.kafka.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author wanghongli
 * @date 2023/4/1 15:50
 * @description KafkaProperties
 **/
@Data
@ConfigurationProperties(prefix = "yg.kafka")
public class YgKafkaProperties {
    private String bootstrapServer;
    private String securityProtocol;
    private String saslMechanism;
    private String saslUsername;
    private String saslPassword;
    private String saslTruststorePassword;
    private String sslEndpointIdentificationAlgorithm = "";
    //绝对路径，否则容易报错.
    private String sslTruststoreLocation;
    /**
     * 生产者配置
     */
    private boolean producerEnable = false;
    private Integer producerMaxBlockMs = 6000;
    private Integer producerRetries = 3;
    private Integer producerReconnectBackoffMs = 3000;
    private String producerKeySerializer = "org.apache.kafka.common.serialization.StringSerializer";
    private String producerValueSerializer = "org.apache.kafka.common.serialization.ByteArraySerializer";
    /**
     * 消费组配置
     */
    private boolean consumerEnable = false;
    private String consumerGroupId = "";
    private Boolean consumerAutoCommit = true;
    private Integer consumerAutoCommitInterval = 5000;
    private Integer consumerMaxPollRecords = 30;
    private Integer consumerMaxPartitionFetchBytes = 32000;
    private Integer consumerFetchMaxBytes = 32000;
    private Integer consumerSessionTimeout = 30000;
    private Boolean consumerBatchListener = true;
    private Integer consumerConcurrency = 2;
    private String consumerKeyDeserializer = "org.apache.kafka.common.serialization.StringDeserializer";
    private String consumerValueDeserializer = "org.apache.kafka.common.serialization.StringDeserializer";
}
